<template>
  <view>
    <view class="goods-list" v-for="(item,i) in goodsList" :key="i" >
      <block  >
    <my-goods :goods='item' ></my-goods>
          <!-- 商品右侧信息区域 -->
      
      </block>
    </view>
  </view>
</template>

<script>
	export default {
		data() {
			return {
				queryObj:{
          query:'',
          cid:'',
          pagenum:1,
          pagesize:10
        },
        goodsList:[]
			}
		},
    onLoad(option){
      
      this.queryObj.query=option.query || ''
       // this.queryObj.cid=option.cat_id
       this.getGoodsList()
    },
    methods:{
      // 拿商品列表数据
     async getGoodsList(){
       const {data:res}=await uni.$http.get('/api/public/v1/goods/search',this.queryObj) 
        if(res.meta.status!==200)return uni.$showMsg()
        this.goodsList=res.message.goods
        console.log(this.goodsList)
      },
    }
	}
</script>

<style lang="scss">
  .goods-item {
    display: flex;
    padding: 10px 5px;
    border-bottom: 1px solid #f0f0f0;
  
    .goods-item-left {
      margin-right: 5px;
  
      .goods-pic {
        width: 100px;
        height: 100px;
        display: block;
      }
    }
  
    .goods-item-right {
      display: flex;
      flex-direction: column;
      justify-content: space-between;
  
      .goods-name {
        font-size: 13px;
      }
  
      .goods-price {
        font-size: 16px;
        color: #c00000;
      }
    }
  }

</style>
